home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Grafik / Misc / ImageEnginer / ARexx / Batch / Halftone.ieb < prev    next >
Encoding:
Text File  |  1997-02-02  |  3.0 KB  |  118 lines

  1. /*
  2. ** $VER: Halftone.ieb 1.11, IE Arexx script
  3. ** Image Engineer Batch Processing script
  4. ** Copyright © by Patrik M Nydensten
  5. ** 1/2 1997 Stockholm/Sweden
  6. **
  7. ** Halftone PRIMARY image with ALPHA channel.
  8. */
  9.  
  10. options results
  11. signal on error
  12.  
  13. parse arg input command
  14. input = upper(strip(input))
  15. address 'IMAGEENGINEER'
  16.  
  17. select  /* Required batch script commands */
  18.   when input = 'INFO' then    return get_info()
  19.   when input = 'CONFIG' then  return get_config(command)
  20.   when input = 'PROCESS' then return process_image(command)
  21.   otherwise do
  22.     'REQUEST' '"Failure in call to batch script!"' '" Quit "'
  23.     return '<ERROR>'
  24.   end
  25. end
  26.  
  27. exit 0
  28.  
  29. /* Required "Get_info" procedure  ------------------------------------ */
  30. /* S = SECONDARY, A = ALPHA; 1 = Single file, 2 = Multiple files       */
  31.  
  32. get_info:
  33.   back = 'OK A2'
  34. return back
  35.  
  36. /* Required "Get_config" procedure  ---------------------------------- */
  37.  
  38. get_config:
  39.   parse arg '"'command'"'
  40.  
  41.   if command = '' then gtext = 'OK'
  42.   else gtext = 'Yeah, you just told me!'
  43.  
  44.   'REQUEST' '"The Halftone batch script does'd2c(10)'not have any settings."' '"' gtext '"'
  45.  
  46.   back = 'OK'
  47. return back
  48.  
  49. /* Required "Process_image" procedure  ------------------------------- */
  50.  
  51. process_image:
  52.   parse arg '"'src_image'"' '"'dst_image'"' '"'options'"' '"'alp_image'"'
  53.   parse var options nil
  54.  
  55.   'OPEN' '"'src_image'"' '24'
  56.   if (RC ~= 0) then do
  57.     'IE_TO_FRONT'
  58.     'REQUEST' '"Failed to load image:' d2c(10)||src_image'"' '" OK "'
  59.     return '<ERROR>'
  60.   end
  61.   else LoadImage = result
  62.  
  63.   'OPEN' '"'alp_image'"' '8'
  64.   if (RC ~= 0) then do
  65.     'IE_TO_FRONT'
  66.     'REQUEST' '"Failed to load alpha image:' d2c(10)||alp_image'"' '" OK "'
  67.     return '<ERROR>'
  68.   end
  69.   else AlphaImage = result
  70.  
  71.   'MARK' LoadImage 'PRIMARY'
  72.   'MARK' AlphaImage 'ALPHA'
  73.  
  74.   'HALFTONE'
  75.   OutputImage = result
  76.   'CLOSE' LoadImage
  77.   'CLOSE' AlphaImage
  78.  
  79.   if left(getclip('cfg_save_frmt'),4)~='ILBM' then do
  80.     'CONVERT_TO_COLOUR' OutputImage
  81.     NewImage = result
  82.     'CLOSE' OutputImage
  83.     OutputImage = NewImage
  84.   end
  85.  
  86.   if getclip('cfg_save_frmt')='' then setclip('cfg_save_frmt','ILBM CmpByteRun1')
  87.   'SAVE_DATA' OutputImage '"'dst_image'"' '"'getclip('cfg_save_frmt')'"'
  88.   if (RC ~= 0) then do
  89.     'IE_TO_FRONT'
  90.     'REQUEST' '"Failed to save image:' d2c(10)||dst_image'"' '" OK "'
  91.     return '<ERROR>'
  92.   end
  93.   'CLOSE' OutputImage
  94.  
  95.   back = 'OK'
  96. return back
  97.  
  98. /* Internal procedures  ---------------------------------------------- */
  99.  
  100. /*******************************************************************/
  101. /* This is where control goes when an error code is returned by IE */
  102. /* It puts up a message saying what happened and on which line     */
  103. /*******************************************************************/
  104.  
  105. error:
  106. if RC=5 then do
  107.     IE_TO_FRONT
  108.     LAST_ERROR
  109.     'REQUEST "'||RESULT||'"'
  110. end
  111. else do
  112.     IE_TO_FRONT
  113.     LAST_ERROR
  114.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  115. end
  116.  
  117. return '<ERROR>'
  118.